<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
set_time_limit(0);
$_SERVER["DOCUMENT_ROOT"] = "/home/share/www/SourceSite-utf8/secure";
include("/home/share/www/SourceSite-utf8/secure/config.inc.php");

$arrWeb = explode(",", $_data["AllWeb"]);

$strTmp1 = "<tr>
	<td class='web-name'>{No}</td>
	<td class='web-name'>{Web}</td>
	<td class='web-td'>{B1_P0}</td>
	<td class='web-td'>{B1_P1}</td>
	<td class='web-td'>{B1_P2}</td>
	<td class='web-td'>{B1_P3}</td>
	<td class='web-td'>{B1_P4}</td>
	<td class='web-td'>{B1_P5}</td>
	<td class='web-td'>{B1_P6}</td>
	<td class='web-td'>{B2_P0}</td>
	<td class='web-td'>{B2_P1}</td>
	<td class='web-td'>{B2_P2}</td>
	<td class='web-td'>{B2_P3}</td>
	<td class='web-td'>{B2_P4}</td>
	<td class='web-td'>{B2_P5}</td>
	<td class='web-td'>{B2_P6}</td>
	<td class='web-td'>{B3_P0}</td>
	<td class='web-td'>{B3_P1}</td>
	<td class='web-td'>{B3_P2}</td>
	<td class='web-td'>{B3_P3}</td>
	<td class='web-td'>{B3_P4}</td>
	<td class='web-td'>{B3_P5}</td>
	<td class='web-td'>{B3_P6}</td>
	<td class='web-td'>{B4_P0}</td>
	<td class='web-td'>{B4_P1}</td>
	<td class='web-td'>{B4_P2}</td>
	<td class='web-td'>{B4_P3}</td>
	<td class='web-td'>{B4_P4}</td>
	<td class='web-td'>{B4_P5}</td>
	<td class='web-td'>{B4_P6}</td>
</tr>";

$intTotalN = 0;
$intTotalM = 0;
$flTotalR = 0;
$arrDB = array();
$strCon = "";
$intNo = 0;

$_isDBExist = "no";
$_DBSite = "Master";

$strSQL1 = "select MemberGroup, SpGroup, COUNT(*) as UserNo, SUM(IF(SkypeAcc != '', 1, 0)) as SkypeNo  from `bet_Member` where MemberGroup < 10 and isLock = 0 group by MemberGroup, SpGroup";

$arrTolUserNo = array();
foreach($arrWeb as $strWeb){
	$arrW = explode("@", $strWeb);
	$strWeb = $arrW[0];
	$_blDBHostM = "";
	include("/home/share/www/".$arrW[1]."/secure/db.inc.php");
	if($_blDBHostM == "")continue;

	$strTmp2 = $strTmp1;
	$strTmp2 = str_replace("{Web}", $strWeb." -- {".$strWeb."} &nbsp;(".$_blDBHostM.")", $strTmp2);
	$intNo++;
	$strTmp2 = str_replace("{No}", $intNo, $strTmp2);

	$arrUserNo = array();
	$arrSkypeNo = array();
	$RS = @PMA_mysql_query($strSQL1, $$_Conn);
	while($Rows = PMA_mysql_fetch_object($RS)){
		$arrUserNo[$Rows -> MemberGroup][$Rows -> SpGroup] = $Rows -> UserNo;
		$arrSkypeNo[$Rows -> MemberGroup][$Rows -> SpGroup] = $Rows -> SkypeNo;
	}

	for($intB = 1; $intB <= 4; $intB++){
		for($intP = 0; $intP <= 6; $intP++){
				$strTmp2 = str_replace("{B".$intB."_P".$intP."}", $arrUserNo[$intB][$intP]."<br />(".$arrSkypeNo[$intB][$intP].")", $strTmp2);
				$arrTolUserNo[$intB][$intP] +=  $arrUserNo[$intB][$intP];
		}
	}
	$strCon .= $strTmp2;
	@mysql_free_result($RS);
	@mysql_close($$_Conn);
}

$strTmp2 = str_replace("{Web}", "Sum", $strTmp1);
$strTmp2 = str_replace("{No}", "", $strTmp2);
for($intB = 1; $intB <= 4; $intB++){
	for($intP = 0; $intP <= 6; $intP++){
		$strTmp2 = str_replace("{B".$intB."_P".$intP."}", (int)$arrTolUserNo[$intB][$intP], $strTmp2);
	}
}
$strCon .= $strTmp2;
?><!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> SpUser </title>
<style>
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-size: 12px
	font-family: Arial, Helvetica, Verdana, Geneva,  sans-serif;
	background-color: #EFFFDF;
}
td {
	font-size: 12px
	font-family: Arial, Helvetica, Verdana, Geneva,  sans-serif;
	background-color: #FFFFFF;
	text-align: center;
}
.showTable {
	background-color: #9DBAD8;
	border: 1px solid #056FD8;
}
.web-td {
	text-align: right;
	padding-right: 2px;
}
.web-name {
	text-align: left;
	padding-left: 2px;
}
//-->
</style>
</head>

<body>
<table  border="0" cellspacing="1" cellpadding="0" class="showTable">
<tr>
	<td width="50" rowspan="3">序號</td>
	<td width="150" rowspan="3">網站</td>
	<td colspan="28"></td>
</tr>
<tr>
	<td colspan="7">會員</td>
	<td colspan="7">代理商</td>
	<td colspan="7">總代理</td>
	<td colspan="7">股東</td>
</tr>
<tr>
	<td width="40">一般</td>
	<td width="40">VIP1</td>
	<td width="40">VIP2</td>
	<td width="40">VIP3</td>
	<td width="40">VIP4</td>
	<td width="40">VIP5</td>
	<td width="40">VIP6</td>
	<td width="40">一般</td>
	<td width="40">VIP1</td>
	<td width="40">VIP2</td>
	<td width="40">VIP3</td>
	<td width="40">VIP4</td>
	<td width="40">VIP5</td>
	<td width="40">VIP6</td>
	<td width="40">一般</td>
	<td width="40">VIP1</td>
	<td width="40">VIP2</td>
	<td width="40">VIP3</td>
	<td width="40">VIP4</td>
	<td width="40">VIP5</td>
	<td width="40">VIP6</td>
	<td width="40">一般</td>
	<td width="40">VIP1</td>
	<td width="40">VIP2</td>
	<td width="40">VIP3</td>
	<td width="40">VIP4</td>
	<td width="40">VIP5</td>
	<td width="40">VIP6</td>
</tr>
<?php print $strCon;?>
</table>
現在時間：<?php print date("Y-m-d H:i:s");?><br /><br />
</body>
</html>